package br.com.escolaespacocrianca.fineec.model;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import br.com.caelum.stella.inwords.FormatoDeExtenso;
import br.com.caelum.stella.inwords.FormatoDeReal;
import br.com.caelum.stella.inwords.NumericToWordsConverter;
import br.com.escolaespacocrianca.fineec.model.enums.DayOfPayment;
import br.com.escolaespacocrianca.fineec.model.enums.EnrollmentStatus;
import br.com.escolaespacocrianca.fineec.model.enums.GradeType;

@Entity
public class Enrollment extends BaseEntity {
	
	private boolean hasBirthCertificate;
	private boolean hasVaccinationCard;
	private boolean hasFacePhotos;
	private boolean hasHealthPlanCard;
	private boolean hasRegistrationNumberXerox;
	private boolean hasCPFXerox;
	private boolean hasLastYearSchoolDischarge;
	private boolean hasAddressProof;
	
	private boolean exemptPlots;
	
	private ShiftType shift;
	private GradeType grade;
	private Month monthOfEnrollment;
	private Double price;
	private Integer year;
	
	@OneToOne
	@Cascade(value={CascadeType.REFRESH})
	private Student student;
	
	private DayOfPayment dayOfPayment;
	
	private EnrollmentStatus status;
	
	@OneToMany
	@Cascade(value={CascadeType.SAVE_UPDATE})
	private List<Plot> plots;
	
	@OneToMany
	@Cascade(value={CascadeType.SAVE_UPDATE})
	private List<ExtraService> extraServices;

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	public EnrollmentStatus getStatus() {
		return status;
	}

	public void setStatus(EnrollmentStatus status) {
		this.status = status;
	}

	public ShiftType getShift() {
		return shift;
	}

	public void setShift(ShiftType shift) {
		this.shift = shift;
	}

	public GradeType getGrade() {
		return grade;
	}

	public void setGrade(GradeType grade) {
		this.grade = grade;
	}

	public DayOfPayment getDayOfPayment() {
		return dayOfPayment;
	}

	public void setDayOfPayment(DayOfPayment dayOfPayment) {
		this.dayOfPayment = dayOfPayment;
	}

	public boolean isHasBirthCertificate() {
		return hasBirthCertificate;
	}

	public void setHasBirthCertificate(boolean hasBirthCertificate) {
		this.hasBirthCertificate = hasBirthCertificate;
	}

	public boolean isHasVaccinationCard() {
		return hasVaccinationCard;
	}

	public void setHasVaccinationCard(boolean hasVaccinationCard) {
		this.hasVaccinationCard = hasVaccinationCard;
	}

	public boolean isHasFacePhotos() {
		return hasFacePhotos;
	}

	public void setHasFacePhotos(boolean hasFacePhotos) {
		this.hasFacePhotos = hasFacePhotos;
	}

	public boolean isHasHealthPlanCard() {
		return hasHealthPlanCard;
	}

	public void setHasHealthPlanCard(boolean hasHealthPlanCard) {
		this.hasHealthPlanCard = hasHealthPlanCard;
	}

	public boolean isHasLastYearSchoolDischarge() {
		return hasLastYearSchoolDischarge;
	}

	public void setHasLastYearSchoolDischarge(boolean hasLastYearSchoolDischarge) {
		this.hasLastYearSchoolDischarge = hasLastYearSchoolDischarge;
	}

	public boolean isHasAddressProof() {
		return hasAddressProof;
	}

	public void setHasAddressProof(boolean hasAddressProof) {
		this.hasAddressProof = hasAddressProof;
	}

	public boolean isHasRegistrationNumberXerox() {
		return hasRegistrationNumberXerox;
	}

	public void setHasRegistrationNumberXerox(boolean hasRegistrationNumberXerox) {
		this.hasRegistrationNumberXerox = hasRegistrationNumberXerox;
	}

	public boolean isHasCPFXerox() {
		return hasCPFXerox;
	}

	public void setHasCPFXerox(boolean hasCPFXerox) {
		this.hasCPFXerox = hasCPFXerox;
	}

	public Month getMonthOfEnrollment() {
		return monthOfEnrollment;
	}

	public void setMonthOfEnrollment(Month monthOfEnrollment) {
		this.monthOfEnrollment = monthOfEnrollment;
	}

	public List<Plot> getPlots() {
		return plots;
	}

	public void setPlots(List<Plot> plots) {
		this.plots = plots;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public List<ExtraService> getExtraServices() {
		return extraServices;
	}

	public void setExtraServices(List<ExtraService> extraServices) {
		this.extraServices = extraServices;
	}
	
	public String priceToWords(){
		FormatoDeExtenso formato = new FormatoDeReal();
		NumericToWordsConverter converter = new NumericToWordsConverter(formato);
		return converter.toWords(price);
	}

	public Integer getYear() {
		return year;
	}

	public void setYear(Integer year) {
		this.year = year;
	}

	public boolean isExemptPlots() {
		return exemptPlots;
	}

	public void setExemptPlots(boolean exemptPlots) {
		this.exemptPlots = exemptPlots;
	}


}
